

<div class="p-h-md p-v bg-white box-shadow pos-rlt">
  <h3 class="no-margin">广告管理</h3>
</div>
<div class="p-md">
  <div class="panel panel-default">
    <div class="panel-heading">广告列表</div>
    <div class="panel-body">
      <div class="pull-right hidden-xs w">
      </div>
      <a href="javascript:window.location.href='<%= new_ad_group_path  %>'"><button type="button" ui-sref="app.add" class="btn btn-sm btn-success ng-click-active"> <i class="glyphicon glyphicon-plus"></i>
        新建广告
      </button></a>
    </div>
    <table class="table table-bordered table-hover bg-white">
      <thead>
      <tr>
        <th>广告名称</th>
        <th>起止时间</th>
        <th>曝光量</th>
        <th>点击数</th>
        <th>点击率</th>
        <th>出价</th>
        <th>点击均价</th>
        <th>花费</th>
        <th>状态</th>
      </tr>
      </thead>
      <tbody>
      </tbody><colgroup><col>
      <col width="9%">
      <col width="9%">
      <col width="9%">
      <col width="9%">
      <col width="9%">
      <col width="9%">
      <col width="9%">
      <col width="9%">
      <col width="7%">
    </colgroup>
      <tbody>
      <% @ad_group_rpts&.each do |group| %>

          <tr>
            <td>
              <%=  link_to group.title , edit_ad_group_path(id: group.id)%>
            </td>
            <td>
              <%=  group.ad_put_type == 1 ? :'一直投放':"#{group.ad_put_start_at}-#{group.ad_put_end_at}" %>
            </td>
            <td><%= group.view_num %></td>
            <td><%= group.click_num %></td>
            <td><%= format("%0.2f", group.click_num.to_i*100/group.view_num.to_i) %>%</td>
            <td><%= number_to_currency(group.ad_offer,  :unit=>"￥")%></td>
            <td><%= number_to_currency(group.cost/group.click_num,  :unit=>"￥")%></td>
            <td><%= number_to_currency(group.cost,  :unit=>"￥")%></td>
            <td>
              <%= link_to '', group, method: :delete, data: {confirm: '确定删除么?'} ,class: 'fa fa-trash-o m-l-sm materials-action-icon'%>
            </td>
          </tr>
      <% end %>

      </tbody>
    </table>
    <div class="text-center">
      <%= will_paginate  @ad_group_rpts%>
    </div>
  </div>
</div>